package thread;

/**
 * interrupted & isInterrupted区别
 */
public class Demo9 {
    public static void main(String[] args) {
        Thread thread=Thread.currentThread();
        System.out.println(thread.getName());

        thread.interrupt();
        /*
        //因为调用一次之后把标志位清了
        System.out.println(Thread.interrupted());//true
        System.out.println(Thread.interrupted());//false
        System.out.println(Thread.interrupted());//false
        */
        //不会清除标志位
        System.out.println(thread.isInterrupted());//true
        System.out.println(thread.isInterrupted());//true
        System.out.println(thread.isInterrupted());//true
    }
}
